package com.bdth.weget.controller;


import com.bdth.weget.entity.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author LGP
 * @since 2018-11-08
 */
@Controller
public class HomeController extends BaseController{
    @RequestMapping("/")
    public String index(HttpServletRequest request, HttpServletResponse response){
        User bean = (User) request.getSession().getAttribute("loginUser");
        if(bean==null){
            return "sys/login";
        }
        if(bean.getGroupid()==0)
            return "sys/admin";
        else
            return "sys/user"+bean.getGroupid();
    }

    @RequestMapping(value = "/portal/index")
    public String home(){
        return "portal/index";
    }

}
